<template>
  <div>
    <el-dialog
      title="产线工序工时配置"
      width="50%"
      :visible.sync="dialogVisible"
    >
      <my-table
        :columns="type == 1 ? settingColumns1 : settingColumns"
        :data="settingData"
      />
    </el-dialog>
  </div>
</template>

<script>
import myTable from '@/components/table/myTable'
export default {
  components: { myTable },
  props: {
    value: {
      type: Boolean,
      default: false
    },
    type: {
      type: [Number, String],
      default: '',
      required: false
    }
  },
  data() {
    return {
      dialogVisible: false,
      form: {},
      settingColumns: [
        {
          label: '工序',
          prop: 'index'
        },
        {
          label: '最早上线时间',
          prop: 'index'
        },
        {
          label: '最晚下线时间',
          prop: 'index'
        },
        {
          label: '可生产时间(h)',
          prop: 'index'
        },
        {
          label: '外协最早上线时间',
          prop: 'earliestOnlineTime',
          slot: 'earliestOnlineTime'
        },
        {
          label: '外协最晚下线时间',
          prop: 'latestOfflineTime',
          slot: 'latestOfflineTime'
        },
        {
          label: '外协交期',
          prop: 'diplomaticPeriod',
          slot: 'diplomaticPeriod'
        },
        {
          label: '外协可生产时间',
          prop: 'index'
        },
        {
          label: '资源名称',
          prop: 'index'
        },
        {
          label: '投入资源数量',
          prop: 'resourcesNum',
          slot: 'resourcesNum'
        },
        {
          label: '单人单机下工时(s/件)',
          prop: 'index'
        },
        {
          label: '资源约束下工时(s/件)',
          prop: 'index'
        },
        {
          label: '本厂可产量(件)',
          prop: 'index'
        },
        {
          label: '外协可产量(件)',
          prop: 'index'
        },
        {
          label: '可排产量(件)',
          prop: 'index'
        },
        {
          label: '本厂实际排产量',
          prop: 'factoryActualOutput',
          slot: 'factoryActualOutput'
        },
        {
          label: '外协实际排产量',
          prop: 'outsourcingActualOutput',
          slot: 'outsourcingActualOutput'
        },
        {
          label: '实际排产量(件)',
          prop: 'index'
        },
        {
          label: '本厂占用时间(h)',
          prop: 'index'
        },
        {
          label: '外协剩余可产标准品件数(件)',
          prop: 'index'
        },
        {
          label: '周期内外协剩余可产时间(h)',
          prop: 'index'
        },
        {
          label: '周期内剩余可生产时间(h)',
          prop: 'index'
        },
        {
          label: '剩余时间可产标准品件数(件)',
          prop: 'index'
        }
      ],
      settingColumns1: [
        {
          label: '工序',
          prop: 'index'
        },
        {
          label: '最早上线时间',
          prop: 'index'
        },
        {
          label: '最晚下线时间',
          prop: 'index'
        },
        {
          label: '可生产时间(h)',
          prop: 'index'
        },
        {
          label: '外协最早上线时间',
          prop: 'earliestOnlineTime'
        },
        {
          label: '外协最晚下线时间',
          prop: 'latestOfflineTime'
        },
        {
          label: '外协交期',
          prop: 'diplomaticPeriod'
        },
        {
          label: '外协可生产时间',
          prop: 'index'
        },
        {
          label: '资源名称',
          prop: 'index'
        },
        {
          label: '投入资源数量',
          prop: 'resourcesNum'
        },
        {
          label: '单人单机下工时(s/件)',
          prop: 'index'
        },
        {
          label: '资源约束下工时(s/件)',
          prop: 'index'
        },
        {
          label: '本厂可产量(件)',
          prop: 'index'
        },
        {
          label: '外协可产量(件)',
          prop: 'index'
        },
        {
          label: '可排产量(件)',
          prop: 'index'
        },
        {
          label: '本厂实际排产量',
          prop: 'factoryActualOutput'
        },
        {
          label: '外协实际排产量',
          prop: 'outsourcingActualOutput'
        },
        {
          label: '实际排产量(件)',
          prop: 'index'
        },
        {
          label: '本厂占用时间(h)',
          prop: 'index'
        },
        {
          label: '外协剩余可产标准品件数(件)',
          prop: 'index'
        },
        {
          label: '周期内外协剩余可产时间(h)',
          prop: 'index'
        },
        {
          label: '周期内剩余可生产时间(h)',
          prop: 'index'
        },
        {
          label: '剩余时间可产标准品件数(件)',
          prop: 'index'
        }
      ],
      settingData: []
    }
  },
  watch: {
    value: {
      immediate: true,
      deep: true,
      handler(val) {
        if (val && val !== this.dialogVisible) {
          this.dialogVisible = val
          if (val) {
            //   this.selectRows = {}
            //   this.$refs?.table?.$refs?.myTable.setCurrentRow()
          }
        }
      }
    },
    dialogVisible(val) {
      this.$emit('input', val)
    }
  },
  created() {},
  mounted() {},
  methods: {
    handleClose() {
      this.dialogVisible = false
    }
  }
}
</script>

<style scoped lang="scss"></style>
